
<html>
<head>
<meta charset="utf-8">
<title>尾气检验报告验证</title>
<meta name="viewport"
	content="width=device-width, initial-scale=1, user-scalable=0">
<link href="https://xjjy.natapp4.cc/JCSystem/resources/css/weui1.css"
	rel="stylesheet">
<script
	src="https://xjjy.natapp4.cc/JCSystem/resources/js/jquery-1.9.1.min.js"></script>
<script
	src="https://xjjy.natapp4.cc/JCSystem/resources/js/jquery.min.js?v=2.1.4"></script>
<script
	src="https://xjjy.natapp4.cc/JCSystem/resources/js/plugins/layer/layer.js"></script>
<style>
.weui-cell_input {
	padding-top: 0;
	padding-bottom: 0;
}

.weui-input {
	width: 100%;
	height: 2.58823529em;
	min-height: 2.58823529em;
	line-height: 2.58823529em;
}

.weui-cell__bd {
	-webkit-box-flex: 1;
	-webkit-flex: 1;
	flex: 1;
}

.weui-textarea {
	display: block;
	width: 100%;
}

.weui-textarea-counter {
	color: #B2B2B2;
	text-align: right;
}

.weui-textarea-counter_warn {
	color: #E64340;
}
</style>
</head>
<body>
	<div class="wxapi_container">
		<div class="lbox_close wxapi_form">
			<h3 id="menu-scan">车架号</h3>
			<input type="text" class="weui-input weui-cell_input weui-cell__bd " id=cjh value="">
			<h3 id="menu-scan">尾气检验报告</h3>
			<button class="btn btn_primary" id="scanQRCode0">尾气检验报告扫一扫</button>
			<h3 id="menu-scan">尾气检验报告结果</h3>
			<input type="text" class="weui-input weui-cell_input weui-cell__bd " id=bg0 value="" readonly="readonly">
			<input type="text" class="weui-input weui-cell_input weui-cell__bd " id=bg1 value="" readonly="readonly">
			<input type="text" class="weui-input weui-cell_input weui-cell__bd " id=bg2 value="" readonly="readonly">
			<input type="text" class="weui-input weui-cell_input weui-cell__bd " id=bg3 value="" readonly="readonly">
			<input type="text" class="weui-input weui-cell_input weui-cell__bd " id=bg4 value="" readonly="readonly">
			<input type="text" class="weui-input weui-cell_input weui-cell__bd " id=bg5 value="" readonly="readonly">
			<h3 id="menu-scan">尾气检验报告验证</h3>
			<input type="text" class="weui-input weui-cell_input weui-cell__bd " id=yzjg value="" readonly="readonly">
			<button class="btn btn_primary" id="closeWindow">退出</button>
			<h3 id="menu-scan">操作指南：</h3>
			<span class="desc">1.在车架号框内输入相关的车辆的车架号</span>  
			<span class="desc">2.点击尾气检验报告扫一扫，扫报告上的二维码</span>  
			<span class="desc">3.尾气检验报告验证中查看验证结果</span>  
		</div>
	</div>
	<input type="hidden" id=appId value="${json.appId!}">
	<input type="hidden" id=timestamp value="${json.timestamp!}">
	<input type="hidden" id=nonceStr value="${json.nonceStr!}">
	<input type="hidden" id=signature value="${json.signature!}">

</body>
<script src="https://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
<script>
/*    
* 注意：    
* 1. 所有的JS接口只能在公众号绑定的域名下调用，公众号开发者需要先登录微信公众平台进入“公众号设置”的“功能设置”里填写“JS接口安全域名”。    
* 2. 如果发现在 Android 不能分享自定义内容，请到官网下载最新的包覆盖安装，Android 自定义分享接口需升级至 6.0.2.58 版本及以上。    
* 3. 完整 JS-SDK 文档地址：http://mp.weixin.qq.com/wiki/7/aaa137b55fb2e0456bf8dd9148dd613f.html    
*    
* 如有问题请通过以下渠道反馈：    
* 邮箱地址：weixin-open@qq.com    
* 邮件主题：【微信JS-SDK反馈】具体问题    
* 邮件内容说明：用简明的语言描述问题所在，并交代清楚遇到该问题的场景，可附上截屏图片，微信团队会尽快处理你的反馈。    
*/    
var appId = $("#appId").val();
var timestamp = $("#timestamp").val();
var nonceStr = $("#nonceStr").val();
var signature = $("#signature").val();
wx.config({
    debug: false,
    appId: appId,
    timestamp: timestamp,
    nonceStr: nonceStr,
    signature: signature,
    jsApiList: ['closeWindow', 'scanQRCode']
});
wx.ready(function() {
    // 8.7 关闭当前窗口
    document.querySelector('#closeWindow').onclick = function() {
        wx.closeWindow();
    };
    // 9 微信原生接口
    // 9.1.1 扫描二维码并返回结果
    document.querySelector('#scanQRCode0').onclick = function() {
		$("#bg").val("");
		$("#yzjg").val("");
       wx.scanQRCode({
            needResult: 1,
            desc: 'scanQRCode desc',
            success: function(res) {
                var ewm = res.resultStr;
                $.ajax({
                    url: 'https://xjjy.natapp4.cc/JCSystem/mobile/decrypt/decrypt.do',
                    cache: false,
                    type: 'POST',
                    data: {
                        ewm: ewm
                    },
                    success: function(result) {
						var jg =$.parseJSON(result);
						if(jg.success){
							var bg =jg.data;
							var fz = bg.split(',/n');
							if(fz.length==1){
								fz = bg.split(',');
								$("#bg0").val(fz[0]);
								$("#bg1").val(fz[1]);
								$("#bg2").val(fz[2]);
								$("#bg3").val(fz[3]);
								$("#bg4").val(fz[4]);
								$("#yzjg").val("版本不同，不进行相关比较验证！");
								
							}else{
								$("#bg0").val(fz[0]);
								$("#bg1").val(fz[1]);
								$("#bg2").val(fz[2]);
								$("#bg3").val(fz[3]);
								$("#bg4").val(fz[4]);
								$("#bg5").val(fz[5]);
								var cjhsr = $("#cjh").val();
								if(cjhsr!=''&&cjhsr!=null){
									var cjhbg = fz[2];
									var cjhfz = cjhbg.split(':');
									var x=document.getElementById("yzjg");
									var yzjh="无";
									if(cjhsr==cjhfz[1]){
										yzjh ="真";
									}else{
										x.style.color="#F76260";
										yzjh ="假";
									}
									$("#yzjg").val(yzjh);
									}
							}
						}else{
							alert("解析失败！该报告存在疑点");
						}
						
                    },
                    error: function(result) {
                    }
                });
            }
        });
    };
    
    
    
    
});
wx.error(function(res) {
    alert(res.errMsg);
});


</script>
</html>